package com.by.service.impl;

import com.by.bean.Destination;
import com.by.common.bean.PageBean;
import com.by.common.crud.BaseServiceImpl;
import com.by.mapper.DestinationMapper;
import com.by.query.DestinationQuery;
import com.by.service.DestinationService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class DestinationServiceImpl extends BaseServiceImpl<Destination, DestinationMapper> implements DestinationService {

    @Autowired
    DestinationMapper destinationMapper;

    /**
     * 分页查询
     * @param query
     * @return
     */
    public PageBean query(DestinationQuery query) {
        PageHelper.startPage(query.getPage(),query.getPageSize());
        List list = destinationMapper.query(query);
        PageInfo info=new PageInfo(list);
        return new PageBean(query.getPage(),query.getPageSize(),info.getTotal(),list);
    }

    @Override
    public Destination get(String destination_coding) {
        return destinationMapper.get(destination_coding);
    }

}
